﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace LHWebApp
{
    public partial class login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Response.ContentType = "text/plain";
                string userName = Request.Params["loginUsername"];
                string passWord = Request.Params["loginPassword"];
                UserInfo userInfo = Services.Login(userName, passWord);
                if (userInfo != null)
                {
                    Session["CurrentUserInfo"] =  userInfo;
                    userInfo.loginUsername = userName;
                    userInfo.loginPassword = passWord;
                    //Response.Redirect("../main.aspx");
                    Response.Write("{success:true,reason:'登录成功!',action:'1'}");
                }
                else
                    Response.Write("{failure:true,reason:'登录失败，帐号或密码不正确!',action:'1'}");

            }
        }
    }
}
